<fieldset><legend><?php echo t('LBL_ACADEMY', 'academy');?></legend>
<table width="100%">
	<tr>
		<td width="50%" style="vertical-align: top">
		<table class="grid g-academy" id="studyingprocesses">
			<tr>
				<th><?php echo t('LBL_BEGINNING_YEAR', 'studyingProcess') ?></th>
				<th><?php echo t('LBL_ENDING_YEAR', 'studyingProcess') ?></th>
				<th><?php echo t('LBL_ACADEMY_LEVEL', 'studyingProcess') ?></th>
				<th><?php echo t('LBL_SCHOOL_NAME', 'studyingProcess') ?></th>
			</tr>
			<?php
			$index=0;
			foreach($model->academy->studyingProcesses as $id => $item ) :
			if ($item != null && (isset($item->beginning_year)) || isset($item->ending_year) || isset($item->academy_level) || isset($item->school_name)){
				$updated_fields_studyingprocesses = array();
				if($item->updated_fields != NULL)
					$updated_fields_studyingprocesses = explode(',', $item->updated_fields);
				$this->renderPartial ( '_studyform', array (
									'model' => $item,
									'translatedModel' => $translatedModel->academy->studyingProcesses[$id],
									'updated_fields' => $updated_fields_studyingprocesses,
									'index' => $id 
				) );
				$index ++;
			}
			endforeach;
			?>
		</table>
		</td>
		<td width="30px"></td>
		<td style="vertical-align: top">
		<table class="form academy">
			<tr>
				<td class="label" rowspan="2"><?php echo $form->label($model->academy, '[0]best_subject'); ?></td>
				<td class="input disabled<?php echo LGHelpers::checkVNFieldChanged($updated_fields, 'best_subject');?>" style="width: 180px;"><?php            
				echo $form->textField($model->academy, '[0]best_subject', array('disabled'=>'true'));
				?></td>
			</tr>
			<tr>				
				<td class="input" style="width: 180px;"><?php            
				echo $form->textField($translatedModel->academy, '[1]best_subject');
				?></td>
			</tr>
			<tr>
				<td class="label" rowspan="2"><?php echo $form->label($model->academy, '[0]major'); ?></td>
				<td class="input disabled<?php echo LGHelpers::checkVNFieldChanged($updated_fields, 'major');?>"><?php            
				echo $form->textField($model->academy, '[0]major', array('disabled'=>'true'));				
				?></td>
			</tr>
			<tr>				
				<td class="input" style="width: 180px;"><?php            
				echo $form->textField($translatedModel->academy, '[1]major');
				?></td>
			</tr>
			<tr>
				<td class="label" rowspan="2"><?php echo $form->label($model->academy, '[0]certificate'); ?></td>
				<td class="input disabled<?php echo LGHelpers::checkVNFieldChanged($updated_fields, 'certificate');?>"><?php            
				echo $form->textField($model->academy, '[0]certificate', array('disabled'=>'true'));				
				?></td>
			</tr>
			<tr>				
				<td class="input" style="width: 180px;"><?php            
				echo $form->textField($translatedModel->academy, '[1]certificate');
				?></td>
			</tr>
			<tr>
				<td class="label" rowspan="2"><?php echo $form->label($model->academy, '[0]language'); ?></td>
				<td class="input disabled<?php echo LGHelpers::checkVNFieldChanged($updated_fields, 'language');?>"><?php            
				echo $form->textField($model->academy, '[0]language', array('disabled'=>'true'));				
				?></td>
			</tr>
			<tr>				
				<td class="input" style="width: 180px;"><?php            
				echo $form->textField($translatedModel->academy, '[1]language');
				?></td>
			</tr>
		</table>
		</td>
	</tr>
</table>
</fieldset>
<?php
Yii::app()->clientScript->registerCoreScript('jquery');
Yii::app()->clientScript->registerScript('loadstudyingprocess', '
var _index = ' . $index . ';
$("#loadStudyingProcessByAjax").click(function(e){
    e.preventDefault();
    var _url = "' . Yii::app()->controller->createUrl("loadStudyingProcessByAjax", array("load_for" => $this->action->id)) . '&index="+_index;
    $.ajax({
        url: _url,
        success:function(response){
            $("#studyingprocesses").append(response);            
        }
    });
    _index++;
});
', CClientScript::POS_END);
				?>